<template>
<div>
     <el-row :gutter='20'>
        <el-col :span='7'>
            <me-link></me-link>
            <me-notice></me-notice>
        </el-col>
        <el-col :span='17'>
            <me-title :title='title'></me-title>
            <br>
            <div class='box-data-info'>
                <div class='title'>
                    <div class='name'>{{news.title}}</div>
                    <div class='date'>{{news.created_at}}</div>
                </div>
                <div class='article' v-html='news.content'>
                </div>
            </div>
        </el-col>
    </el-row>
</div>
</template>

<script type="text/javascript">
import Link from '@/components/utils/Link'
import Notice from '@/components/utils/Notice'
import Title from '@/components/utils/Title'
import Request from '@/common/Request'
import Common from '@/common/Common'
export default {
    components : {
        'me-link' : Link,
        'me-notice' : Notice,
        'me-title' : Title
    },
    data : function(){
        return {
            'title' : {
                'name' : '新闻资讯',
                'sub' : 'News',
                'posi' : '位置 > ',
                'now' : '资讯',
                'icon' : '/static/image/data/icon-title.png'
            },
            'news' : {}
        }
    },
    created : function(){
        var id = Common.getUrlParam('id')
        if(!id){
            Notify.error('链接无效!')
            Common.toUrl('/')
            return false
        }
        var url = Request.createApi('/app/news/list?where[id]='+id)
        Request.get(url, res => {
            if(!res.list[0]){
                Notify.error('链接无效!')
                Common.toUrl('/')
                return false
            }
            this.news = res.list[0]
        })
    }
}
</script>